package com.skyz.wrap.utils;

import java.util.Map;
import java.util.TreeMap;

public class ApiSignUtil {
    /**
     * 签名秘钥
     */
    private final static String SECURITY_KEY = "0b4f0afd74792f6c039baac4bfdb7f64f0e9cadcb73dacc06a3e2af952384e62";

    public static String getSign(TreeMap<String,String> map){
        StringBuilder sb = new StringBuilder();
        for (Map.Entry entry : map.entrySet()) {
            sb = sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
        }
        sb.append("SECURITY_KEY").append("=").append(SECURITY_KEY);
        String sign = MD5Utils.digest(sb.toString());
        return sign;
    }
}
